****************************************
* YouGov Health Survey - February 2022 *
****************************************
svyset [pweight = weight]

 

*************************
* Independent Variables *
*************************

gen female = gender - 1

//doctor persuasion experiment
label define persuasion 1 "AMA support" 2 "AMA oppose" 3 "D support, R oppose" 4 "R support, D oppose" 5 "bipartisan support" 6 "bipartisan commission" 7 "AMA & D support" 8 "AMA oppose & D support" 9 "AMA & R support" 10 "AMA oppose & R support" 11 "AMA & D & R support" 12 "AMA oppose, D & R support" 13 "AMA & bipartisan commission support" 14 "AMA oppose, bipartisan commission support"
label values q6_treat persuasion

//order effect
gen order = q13_q14_treat
replace order = 1 if q13_q14_treat == 1
replace order = 0 if q13_q14_treat == 2

label define order 1 "Trust most first" 0 "Trust least first"
label values order order

//Attitudes experiment
label define actor 1"Doctors" 2 "Lawyers" 3 "Teachers" 4 "Congress Members"
label values q19_treat actor

//attention check
gen attention = 1 if q1 == 2
replace attention = 0 if q1 != 2

gen proposalSupport = 5 - q6 if q6 < 8 

//age
gen age = 2023 - birthyr
recode age (18/37=1) (38/51=2) (52/64=3) (65/99=4), gen(age4)
tab age4, gen(Dage)

label var age4 "Age"
label define age4 1 "18-37" 2 "38-51" 3 "52-64" 4 "65+"
label values age4 age4

//race
tab race, gen(r_)
rename r_1 r_white
rename r_2 r_black
rename r_3 r_hispanic
gen r_other=r_4+r_5+r_6+r_7+r_8
label var r_white "White"
label var r_black "Black"
label var r_hispanic "Hispanic"
label var r_other "Other Race"

gen race3 = 1 if r_white == 1
replace race3 = 2 if r_black == 1
replace race3 = 3 if r_hispanic == 1

label define race3 1 "White" 2 "Black" 3 "Hispanic"
label values race3 race3 


//health status
gen healthStatus = q5-1
label define healthStatus 0 "Poor" 1 "Fair" 2 "Good" 3 "Very good" 4 "Excellent"
label values healthStatus healthStatus 

//have child
gen haveChild = 2 - child18

//education
recode educ (1 2=1) (3 4=2) (5 6=3) (*=.), gen(educ3)
tab educ3, gen(Deduc)
label var educ3 "Education (3-categories)"
label define educ3 1 "Low" 2 "Medium" 3 "High"
label values educ3 educ3

//relationship status
gen single  = 1 if marstat == 2 | marstat == 3 | marstat == 4 | marstat == 5
replace single = 0 if marstat == 1 | marstat == 6

//has a job (1) vs. not (0)
gen working = 1 if employ == 1 | employ == 2
replace working = 0 if employ > 2

//income (80 prefer not to say)
gen income = faminc_new if faminc_new < 97

recode income (1 2 3 4 = 1) (5 6 7 8 9 = 2) (10 11 12 13 14 15 16= 3), gen(income3)
tab income3, gen(Dincome)

label var income3 "Income"
label define income3 1 "Low" 2 "Medium" 3 "High"
label values income3 income3

//vaccination status
gen vaccinated = 1 if q24 < 5
replace vaccinated = 0 if q24 == 5

//insurance status
recode q4 (1 2 3 = 1) (4 = 0) (5 = .),gen(insured)

//voted in 2020
gen voted2020 = 1 if presvote20post < 6
replace voted2020 = 0 if presvote20post == 6

//Party ID 3
gen partyID_3 = pid3
replace partyID_3 = 3 if partyID_3 > 2

label define partyID_3 1 "Democrat" 2 "Republican" 3 "Independent"
label values partyID_3 partyID_3


//Party ID 7
gen partyID_7 = pid7
replace partyID_7 = 4 if partyID_7 > 7
recode partyID_7 (1=-3) (2=-2) (3=-1) (4 8=0) (5=1) (6=2) (7=3)

label define partyID_7 -3 "Strong Democrat" -2 "Not very strong Democrat" -1 "Lean Democrat" 0 "Independent" 1 "Lean Republican " 2 "Not very strong Republican " 3 "Strong Republican"
label values partyID_7 partyID_7 

//Ideology
recode ideo5 (1=-2) (2=-1) (3 6=0) (4=1) (5=2) (*=.), gen(ideol)
label define ideol -2 "Very liberal" -1 "Liberal" 0 "Moderate" 1 "Conservative" 2 "Very conservative"
label values ideol ideol

//Political interest
recode newsint (1=4) (2=3) (3=2) (4=1) (*=.), gen(interest)
label var interest "Political Interest"
label define interest 1 "Hardly at all" 2 "Only now and then" 3 "Some of the time" 4 "Most of the time"
label values interest interest

recode interest (1 2=1) (3=2) (4=3) (4=1) (*=.), gen(interest3)
tab interest, gen(Dinterest)

//church attendance
gen attend = pew_churatd if pew_churatd < 7
replace attend = 7-attend
label define attend 1 "Never" 2 "Seldom" 3 "A few times a year" 4 "Once or twice a month" 5 "Once a week" 6 "More than once a week"
label values attend attend


***********************
* Dependent Variables * 
***********************

* MEDICAL RESEARCH SCIENTISTS
//confidence in scientists' competence
gen competence = 5-q7

label define confidence 1 "Not at all" 2 "Not too much" 3 "A fair amount" 4 "A great deal"
label values competence confidence

gen highComp = 1 if q7 < 3
replace highComp = 0 if q7 > 2

gen veryComp = 1 if q7 == 1
replace veryComp = 0 if q7 > 1

//confidence in scientists' advice
gen advice = 5-q8
label values advice confidence

gen highadvice = 1 if q8 < 3
replace highadvice = 0 if q8 > 2

gen veryadvice = 1 if q8 == 1
replace veryadvice = 0 if q8 > 1

//scale: 4 = A great deal of confidence; 1 = no confidence at all
egen confidence = rmean (q7 q8)
replace confidence = 5 - confidence
label values confidence confidence

//policymakers should follow scientists' advice
gen follow = 6-q9

gen highfollow = 1 if q9 < 3
replace highfollow = 0 if q9 > 2

gen veryfollow = 1 if q9 == 1
replace veryfollow = 0 if q9 > 1

************************************
* PUBLIC HEALTH EXPERTS
//confidence in public health experts' competence
gen ph_competence = 5-q10
label values ph_competence confidence

gen ph_highComp = 1 if q10 < 3
replace ph_highComp = 0 if q10 > 2

gen ph_veryComp = 1 if q10 == 1
replace ph_veryComp = 0 if q10 > 1

//confidence in public health experts' advice
gen ph_advice = 5-q11
label values ph_advice confidence

gen ph_highadvice = 1 if q11 < 3
replace ph_highadvice = 0 if q11 > 2

gen ph_veryadvice = 1 if q11 == 1
replace ph_veryadvice = 0 if q11 > 1

//scale: 4 = A great deal of confidence; 1 = no confidence at all
egen ph_confidence = rmean (q10 q11)
replace ph_confidence = 5 - confidence
label values ph_confidence confidence

//policymakers should follow public health experts' advice
gen ph_follow = 6-q12

gen ph_highfollow = 1 if q12 < 3
replace ph_highfollow = 0 if q12 > 2

gen ph_veryfollow = 1 if q12 == 1
replace ph_veryfollow = 0 if q12 > 1

*********************
* Trust most, least *
*********************
gen trustMost = q13
replace trustMost = . if trustMost > 5

label define actors 1 "University scientists" 2 "A panel of doctors" 3 "A panel of doctors and citizens" 4 "A commission of business leaders" 5 "An independent government agency"
label values trustMost actors

gen trustLeast = q14
label values trustLeast actors


******************************
* Confidence in institutions *
******************************
*small business
gen smallbiz_conf = q22_a
replace smallbiz_conf = . if smallbiz_conf > 4
replace smallbiz_conf = 5 - smallbiz_conf
label values smallbiz_conf confidence

recode q22_a (1 2 = 1) (3 4 5= 0), gen(q22_aHL)
label var q22_aHL "1=A great deal/Quite a lot; 0=Rest"

*military
gen military_conf = q22_b
replace military_conf = . if military_conf > 4
replace military_conf = 5 - military_conf
label values military_conf confidence

recode q22_b (1 2 = 1) (3 4 5= 0), gen(q22_bHL)
label var q22_bHL "1=A great deal/Quite a lot; 0=Rest"

*police
gen police_conf = q22_c
replace police_conf = . if police_conf > 4
replace police_conf = 5 - police_conf
label values police_conf confidence

recode q22_c (1 2 = 1) (3 4 5= 0), gen(q22_cHL)
label var q22_cHL "1=A great deal/Quite a lot; 0=Rest"

*medical system
gen medical_conf = q22_d
replace medical_conf  = . if medical_conf  > 4
replace medical_conf  = 5 - medical_conf 
label values medical_conf  confidence

recode q22_d (1 2 = 1) (3 4 5= 0), gen(q22_dHL)
label var q22_dHL "1=A great deal/Quite a lot; 0=Rest"

*church
gen church_conf = q22_e
replace church_conf  = . if church_conf  > 4
replace church_conf  = 5 - church_conf 
label values church_conf  confidence

recode q22_e (1 2 = 1) (3 4 5= 0), gen(q22_eHL)
label var q22_eHL "1=A great deal/Quite a lot; 0=Rest"

*public schools
gen school_conf = q22_f
replace school_conf  = . if school_conf  > 4
replace school_conf  = 5 - school_conf 
label values school_conf  confidence

recode q22_f (1 2 = 1) (3 4 5= 0), gen(q22_fHL)
label var q22_fHL "1=A great deal/Quite a lot; 0=Rest"

*organized labor
gen labor_conf = q22_g
replace labor_conf = . if labor_conf > 4
replace labor_conf = 5 - labor_conf
label values labor_conf confidence

recode q22_g (1 2 = 1) (3 4 5= 0), gen(q22_gHL)
label var q22_gHL "1=A great deal/Quite a lot; 0=Rest"

*banks
gen banks_conf = q22_h
replace banks_conf  = . if banks_conf  > 4
replace banks_conf  = 5 - banks_conf 
label values banks_conf  confidence

recode q22_h (1 2 = 1) (3 4 5= 0), gen(q22_hHL)
label var q22_hHL "1=A great deal/Quite a lot; 0=Rest"

*tech companies
gen tech_conf = q22_i
replace tech_conf  = . if tech_conf  > 4
replace tech_conf  = 5 - tech_conf 
label values tech_conf  confidence

recode q22_i (1 2 = 1) (3 4 5= 0), gen(q22_iHL)
label var q22_iHL "1=A great deal/Quite a lot; 0=Rest"

*Supreme court
gen scotus_conf = q22_j
replace scotus_conf = . if scotus_conf > 4
replace scotus_conf = 5 - scotus_conf
label values scotus_conf confidence

recode q22_j (1 2 = 1) (3 4 5= 0), gen(q22_jHL)
label var q22_jHL "1=A great deal/Quite a lot; 0=Rest"

*president
gen pres_conf = q22_k
replace pres_conf = . if pres_conf > 4
replace pres_conf = 5 - pres_conf
label values pres_conf confidence

recode q22_k (1 2 = 1) (3 4 5= 0), gen(q22_kHL)
label var q22_kHL "1=A great deal/Quite a lot; 0=Rest"

*newspapers
gen news_conf = q22_l
replace news_conf = . if news_conf > 4
replace news_conf = 5 - news_conf
label values news_conf confidence

recode q22_l (1 2 = 1) (3 4 5= 0), gen(q22_lHL)
label var q22_lHL "1=A great deal/Quite a lot; 0=Rest"

*criminal justice system
gen crim_conf = q22_m
replace crim_conf = . if crim_conf > 4
replace crim_conf = 5 - crim_conf
label values crim_conf confidence

recode q22_m (1 2 = 1) (3 4 5= 0), gen(q22_mHL)
label var q22_mHL "1=A great deal/Quite a lot; 0=Rest"

*big business
gen bigbiz_conf = q22_n
replace bigbiz_conf = . if bigbiz_conf > 4
replace bigbiz_conf = 5 - bigbiz_conf
label values bigbiz_conf confidence

recode q22_n (1 2 = 1) (3 4 5= 0), gen(q22_nHL)
label var q22_nHL "1=A great deal/Quite a lot; 0=Rest"

*TV news
gen tvnews_conf = q22_o
replace tvnews_conf  = . if tvnews_conf  > 4
replace tvnews_conf  = 5 - tvnews_conf 
label values tvnews_conf  confidence

recode q22_o (1 2 = 1) (3 4 5= 0), gen(q22_oHL)
label var q22_oHL "1=A great deal/Quite a lot; 0=Rest"

*Congress
gen congress_conf = q22_p
replace congress_conf = . if congress_conf > 4
replace congress_conf = 5 - congress_conf
label values congress_conf confidence

recode q22_p (1 2 = 1) (3 4 5= 0), gen(q22_pHL)
label var q22_pHL "1=A great deal/Quite a lot; 0=Rest"

*********************************************
//Covid-19 impacted trust in doctors
recode q15 (2=-1)(3=0)(1=1),gen(md_covid)
label define md_covid -1 "Decreased Trust" 0 "Trust Remained the Same" 1 "Increased Trust"
label values md_covid md_covid

//MDs encouraged precautions
recode q16 (2=0)(3=.),gen(md_precautions)
label var md_precautions "MD precautions: 0 = N; 1 = Y"

//MD opinions on Covid-19
recode q17 (2=0)(3=.),gen(md_opinions)
label var md_opinions "MD opinions: 0 = N; 1 = Y"

//MD views agreement on Covid-19
gen md_views = q18
replace md_views = . if md_views > 5
replace md_views = 5-md_views
label var md_views "MD views: 0(str. disagree)-4(str. agree)"


************************************
* performance of healthcare actors *
************************************
//MDs
recode q21_a (1 2 = 1) (3 4 5= 0), gen(q21_aHL)
label var q21_aHL "q21_aHL) Low-High"

recode q21_a (5=0) (4=1) (3=2) (2=3) (1=4), gen(doctors)
label var doctor "MD rating: 0(Poor)-4(Excellent)"
label values doctor healthStatus

//Nurses
recode q21_b (1 2 = 1) (3 4 5= 0), gen(q21_bHL)
label var q21_bHL "q21_bHL) Low-High"

//Medical research scientists
recode q21_c (1 2 = 1) (3 4 5= 0), gen(q21_cHL)
label var q21_cHL "q21_cHL) Low-High"

//Pharmaceutical companies
recode q21_d (1 2 = 1) (3 4 5= 0), gen(q21_dHL)
label var q21_dHL "q21_dHL) Low-High"

//Health insurance companies
recode q21_e (1 2 = 1) (3 4 5= 0), gen(q21_eHL)
replace q21_eHL = . if q21_eHL > 1
label var q21_eHL "q21_eHL) Low-High"

//FDA
recode q21_f (1 2 = 1) (3 4 5= 0), gen(q21_fHL)
label var q21_fHL "q21_fHL) Low-High"

//CDC
recode q21_g (1 2 = 1) (3 4 5= 0), gen(q21_gHL)
label var q21_gHL "q21_gHL) Low-High"

//Federal public health experts
recode q21_h (1 2 = 1) (3 4 5= 0), gen(q21_hHL)
label var q21_hHL "q21_hHL) Low-High"

//State Public Health Agency
recode q21_i (1 2 = 1) (3 4 5= 0), gen(q21_iHL)
label var q21_iHL "q21_iHL) Low-High"


*****************************
* Medicare drug negotiation *
*****************************
*A
recode q23_a (1 2 = 1) (3 4 5= 0), gen(q23_aHL)
label var q23_aHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_a = 5-q23_a
label define medicare 0 "Strongly oppose" 1 "Somewhat oppose" 2 "Neither support nor oppose" 3 "Somewhat support" 4 "Strongly support"
label values medicare_q23_a medicare

*B
recode q23_b (1 2 = 1) (3 4 5= 0), gen(q23_bHL)
label var q23_bHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_b = 5-q23_b
label values medicare_q23_b medicare

*C
recode q23_c (1 2 = 1) (3 4 5= 0), gen(q23_cHL)
label var q23_cHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_c = 5-q23_c
label values medicare_q23_c medicare

*D
recode q23_d (1 2 = 1) (3 4 5= 0), gen(q23_dHL)
label var q23_dHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_d = 5-q23_d
label values medicare_q23_d medicare

*E
recode q23_e (1 2 = 1) (3 4 5= 0), gen(q23_eHL)
label var q23_eHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_e = 5-q23_e
label values medicare_q23_e medicare

*F
recode q23_f (1 2 = 1) (3 4 5= 0), gen(q23_fHL)
label var q23_fHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_f = 5-q23_f
label values medicare_q23_f medicare

*G
recode q23_g (1 2 = 1) (3 4 5= 0), gen(q23_gHL)
label var q23_gHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_g = 5-q23_g
label values medicare_q23_g medicare

*H
recode q23_h (1 2 = 1) (3 4 5= 0), gen(q23_hHL)
label var q23_hHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_h = 5-q23_h
label values medicare_q23_h medicare

*I
recode q23_i (1 2 = 1) (3 4 5= 0), gen(q23_iHL)
label var q23_iHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_i = 5-q23_i
label values medicare_q23_i medicare

*J
recode q23_j (1 2 = 1) (3 4 5= 0), gen(q23_jHL)
label var q23_jHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_j = 5-q23_j
label values medicare_q23_j medicare

*K
recode q23_k (1 2 = 1) (3 4 5= 0), gen(q23_kHL)
label var q23_kHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_k = 5-q23_k
label values medicare_q23_k medicare

*L
recode q23_l (1 2 = 1) (3 4 5= 0), gen(q23_lHL)
label var q23_lHL "1=Strongly/Somewhat support; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen medicare_q23_l = 5-q23_l
label values medicare_q23_l medicare

***************************
* Attitudes toward actors *
***************************

recode q19_a (1 2 = 1) (3 4 5= 0), gen(q19_aHL)
label var q19_aHL "1=Strongly/Somewhat agree; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen cat_q19_a = 5-q19_a
label define agree 0 "Strongly disagree" 1 "Somewhat disagree" 2 "Neither agree nor disagree" 3 "Somewhat agree" 4 "Strongly agree"
label values cat_q19_a agree

recode q19_b (1 2 = 1) (3 4 5= 0), gen(q19_bHL)
label var q19_bHL "1=Strongly/Somewhat agree; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen cat_q19_b = 5-q19_b
label values cat_q19_b agree

recode q19_c (1 2 = 1) (3 4 5= 0), gen(q19_cHL)
label var q19_cHL "1=Strongly/Somewhat agree; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen cat_q19_c = 5-q19_c
label values cat_q19_c agree

recode q19_d (1 2 = 1) (3 4 5= 0), gen(q19_dHL)
label var q19_dHL "1=Strongly/Somewhat agree; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen cat_q19_d = 5-q19_d
label values cat_q19_d agreement

recode q19_e (1 2 = 1) (3 4 5= 0), gen(q19_eHL)
label var q19_eHL "1=Strongly/Somewhat agree; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen cat_q19_e = 5-q19_e
label values cat_q19_e agreement

recode q19_f (1 2 = 1) (3 4 5= 0), gen(q19_fHL)
label var q19_fHL "1=Strongly/Somewhat agree; 0=Rest"

//categorical variable (from strongly oppose to strongly support)
gen cat_q19_f = 5-q19_f
label values cat_q19_f agree